﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NC.Infrastructure.Domain.Record;
using NC.Infrastructure.DomainDto.Record;

namespace NC.Infrastructure.Mapper
{
    public  static class RecordMapper
    {
        /// <summary>
        /// 获取ApiRecord记录列表简要数据
        /// </summary>
        /// <param name="records"></param>
        /// <returns></returns>
        public static IQueryable<RecordListDto> MapperListDtos(this IQueryable<ApiRecord> records)
        {
            return records.Select(n => new RecordListDto()
            {
                AccessToken = n.AccessToken,
                ApiUrl = n.Url,
                Id = n.Id,
                PersonName = n.Person.Name,
                TargetName = n.Target.Name,
                TargetPng = n.Target.FavirateIco
            });
        }
    }
}
